class Card():
    '''
    'suit' (string) : Card's Color (rgby)
    'rank' (string) : Card's Value (0-9, R, X, W, +2, +4)
    '''

    colors = {
        'red'       :   '\033[91m',
        'white'     :   '\033[97m',
        'dred'       :   '\033[31m',
        'dwhite'     :   '\033[37m',
    }

    suits = { 'spade': '\u2660', 'heart':'\u2665','club':'\u2663','diamond':'\u2666','JACK':'\u265A','jack':'\u265B'}
    
    idMap = {
        'A':'A','2':'2','3':'3','4':'4','5':'5','6':'6','7':'7','8':'8','9':'9','10':'10',
        'J':'J','Q':'Q','K':'K','JACK':'JK','jack':'jk'
    }

    def __init__(self, suit, value):
        '''Initializes Uno Card w/ Color and Value.'''
        self.cardID = '{}{}'.format(self.suits[suit],self.idMap[value])
        self.setSuit(suit)
        self.setValue(value)
        self.setPoints(value)


    #############################################

    ### -\/-  Retrieve Card Information  -\/- ### 
    
    def __repr__(self):
        return "{},{}".format(self.suit, self.value)

    """     def getBigNum(self, reverse, reverseSeed=0):
        '''Returns list of strings to draw card's value on the pile.'''
        bigNums = []
        colorCode = self.colorCode
        colorCodeDark = self.colorCodeDark
        value = self.value
        if value == 'R':
            if not reverse:
                value += str(reverseSeed)
            else:
                value += str(9-reverseSeed)
        for mid in self.bigNums[value]:
            bigNums += ['{}| |{}'.format(colorCode,colorCodeDark)+mid+'{}| |\033[0m\t'.format(colorCode)]
            
        return bigNums """

    def getColor(self):
        '''Returns card's color.'''
        return self.color
    
    def getColorCode(self):
        '''Returns card's color code.'''
        return self.colorCode

    def getSuit(self):
        '''Returns card's color.'''
        return self.suit
    
    def getSuitCode(self):
        '''Returns card's color code.'''
        return self.suitCode

    def getValue(self):
        '''Returns card's value.'''
        return self.value
    
    def getPoints(self):
        '''Returns card's point value.'''
        return self.points
    
    """     def getRow(self,rowNum,hide=False):
        value = self.value
        displaySpace = self.displaySpace
        if hide:
            colorCode = '\033[97m'
            value = '?'
            displaySpace = ' '
        else:
            colorCode = self.colorCode
            if self.isWild():
                if rowNum == 0:  
                    colorCode = '\033[91m'
                elif rowNum == 1:
                    colorCode = '\033[93m'
                elif rowNum == 2:
                    colorCode = '\033[92m'
                elif rowNum == 3:
                    colorCode = '\033[94m'
        
        if rowNum == 0:
            return      '{}\u2666--\u2666\033[0m'.format(colorCode)
        elif rowNum == 1:
            return      '{}|{}{}|\033[0m'.format(colorCode, displaySpace, value)
        elif rowNum == 2:
            if hide:
                return   '{}|? |\033[0m'.format(colorCode)
            else:
                return   '{}|  |\033[0m'.format(colorCode)
        elif rowNum == 3:
            return      '{}\u2666--\u2666\033[0m'.format(colorCode) """

    #############################################

    ### -\/-  Set Card Information  -\/- ### 
    
    def setSuit(self, suit):
        '''Sets Card's color and escape code.'''
        if suit == 'spade':
            self.color = 'white'
            self.colorCode = self.colors['white']
            self.colorCodeDark = self.colors['dwhite']
            self.suit = 'spade'
            self.suitCode = self.suits['spade']
        elif suit == 'heart':
            self.color = 'red'
            self.colorCode = self.colors['red']
            self.colorCodeDark = self.colors['dred']
            self.suit = 'heart'
            self.suitCode = self.suits['heart']
        elif suit == 'club':
            self.color = 'white'
            self.colorCode = self.colors['white']
            self.colorCodeDark = self.colors['dwhite']
            self.suit = 'club'
            self.suitCode = self.suits['club']
        elif suit == 'diamond':
            self.color = 'red'
            self.colorCode = self.colors['red']
            self.colorCodeDark = self.colors['dred']
            self.suit = 'diamond'
            self.suitCode = self.suits['diamond']
        elif suit == 'JACK':
            self.color = 'red'
            self.colorCode = self.colors['red']
            self.colorCodeDark = self.colors['dred']
            self.suit = 'JACK'
            self.suitCode = self.suits['JACK']
        elif suit == 'jack':
            self.color = 'white'
            self.colorCode = self.colors['white']
            self.colorCodeDark = self.colors['dwhite']
            self.suit = 'jack'
            self.suitCode = self.suits['jack']


    def setValue(self, value):
        if value in ('jack','A','2','3','4','5','6','7','8','9','10','J','Q','K','JACK'):
            self.value = value
            """ self.displaySpace = ' '
            if len(value) == 2:
                self.displaySpace = ''
            if value == '0':
                self.jack = True """
                
    def setPoints(self, value):
        if value in ('5','10'):
            self.points = int(value)
        elif value == 'K':
            self.points = 10
        else:
            self.points = 0


    #############################################

    ### -\/-  Wild Card Methods  -\/- ### 

    """ def changeColor(self, color):
        '''Changes Card's Color, Intended for Wild Cards.'''
        self.setColor(color)

    def isWild(self):
        '''Returns if card is a wild card.'''
        return self.wild
    
    def isZero(self):
        return self.zero """